#!/bin/shell 自动上传spring boot项目

upcollector()
{
  ssh root@192.168.1.132 "cd $remotePath;sh shutdown.sh data-collector.jar a"
  scp $path/monitor-data/data-collector/target/data-collector.jar root@192.168.1.132:$remotePath
  ssh root@192.168.1.132 "cd $remotePath;sh startup.sh data-collector.jar;tail -f -n 200 /var/log/yoxnet_monitor/dev/collect/$today/log.0.txt"
}

uptranster()
{
  ssh root@192.168.1.132 "cd $remotePath;sh shutdown.sh data-transfer.jar a"
  scp $path/monitor-data/data-transfer/target/data-transfer.jar root@192.168.1.132:$remotePath
  ssh root@192.168.1.132 "cd $remotePath;sh startup.sh data-transfer.jar;tail -f -n 200 /var/log/yoxnet_monitor/dev/transfer/$today/log.0.txt"
}

path=/Users/pantao/Documents/work/monitor/code/monitor-cloud
remotePath=/opt/monitor
today=`date +%Y-%m-%d`
echo $today
cd $path
mvn clean package

if [ "$1" == "1" ]
then 
echo 1 collector
upcollector
elif [ "$1" == "2" ]
then
echo 2 transter
uptranster
else
echo all
upcollector
uptranster
fi

#ssh root@192.168.1.132 "cd $remotePath;sh shutdown.sh data-collector.jar a"
#scp $path/monitor-data/data-collector/target/data-collector.jar root@192.168.1.132:$remotePath
#ssh root@192.168.1.132 "cd $remotePath;sh startup.sh data-collector.jar;tail -f -n 200 /var/log/yoxnet_monitor/dev/collect/$today/log.0.txt"

#ssh root@192.168.1.132 "cd $remotePath;sh shutdown.sh data-transfer.jar a"
#scp $path/monitor-data/data-transfer/target/data-transfer.jar root@192.168.1.132:$remotePath
#ssh root@192.168.1.132 "cd $remotePath;sh startup.sh data-transfer.jar;tail -f -n 200 /var/log/yoxnet_monitor/dev/transfer/$today/log.0.txt"